# 1 "xml_lexer.mll"
 (*
 * Xml Light, an small Xml parser/printer with DTD support.
 * Copyright (C) 2003 Nicolas Cannasse (ncannasse@motion-twin.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library has the special exception on linking described in file
 * README.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA
 *)

open Lexing
open Xml_parser
open Dtd

type error =
	| EUnterminatedComment
	| EUnterminatedString
	| EIdentExpected
	| ECloseExpected
	| ENodeExpected
	| EAttributeNameExpected
	| EAttributeValueExpected
	| EUnterminatedEntity

type dtd_error =
	| EInvalidDTDDecl
	| EInvalidDTDTag
	| EDTDItemExpected
	| EInvalidDTDElement
	| EInvalidDTDAttribute

exception Error of error
exception DTDError of dtd_error

type pos = int * int * int * int

type dtd_decl =
	| DTDFile of string
	| DTDData of dtd

type dtd_item_type =
	| TElement
	| TAttribute

type token =
	| Tag of string * (string * string) list * bool
	| PCData of string
	| Endtag of string
	| DocType of (string * dtd_decl)
	| Eof

let last_pos = ref 0
and current_line = ref 0
and current_line_start = ref 0

let tmp = Buffer.create 200

let idents = Hashtbl.create 0

let _ = begin
	Hashtbl.add idents "gt;" ">";
	Hashtbl.add idents "lt;" "<";
	Hashtbl.add idents "amp;" "&";
	Hashtbl.add idents "apos;" "'";
	Hashtbl.add idents "quot;" "\"";
end

let init lexbuf =
	current_line := 1;
	current_line_start := lexeme_start lexbuf;
	last_pos := !current_line_start

let close lexbuf =
	Buffer.reset tmp

let pos lexbuf =
	!current_line ,	!current_line_start ,
	!last_pos ,
	lexeme_start lexbuf

let restore (cl,cls,lp,_) =
	current_line := cl;
	current_line_start := cls;
	last_pos := lp

let newline lexbuf =
	incr current_line;
	last_pos := lexeme_end lexbuf;
	current_line_start := !last_pos

let error lexbuf e =
	last_pos := lexeme_start lexbuf;
	raise (Error e)

let dtd_error lexbuf e =
	last_pos := lexeme_start lexbuf;
	raise (DTDError e)

# 114 "xml_lexer.ml"
let __ocaml_lex_tables = {
  Lexing.lex_base = 
   "\000\000\243\255\244\255\001\000\000\000\008\000\010\000\012\000\
    \255\255\011\000\017\000\250\255\000\000\001\000\000\000\000\000\
    \002\000\000\000\000\000\000\000\001\000\253\255\005\000\000\000\
    \001\000\001\000\001\000\252\255\251\255\247\255\020\000\015\000\
    \006\000\003\000\013\000\254\255\024\000\014\000\002\000\000\000\
    \008\000\015\000\044\000\001\000\073\000\071\000\236\000\044\001\
    \122\001\200\001\016\000\034\000\026\000\022\002\100\002\185\000\
    \081\000\186\000\091\000\187\000\022\000\024\000\020\000\070\000\
    \027\000\005\000\017\000\037\000\032\000\046\000\054\000\039\000\
    \040\000\057\000\050\000\095\000\035\000\213\000\188\000\069\000\
    \072\000\004\000\008\000\118\000\102\000\133\000\081\000\090\000\
    \098\000\122\000\131\000\125\000\120\000\121\000\130\000\134\000\
    \125\000\125\000\170\000\134\000\134\000\124\000\134\000\131\000\
    \127\000\159\000\162\000\214\002\036\003\245\255\246\255\145\000\
    \249\255\218\000\161\000\161\000\165\000\148\000\168\000\248\255\
    \194\000\168\000\160\000\170\000\175\000\157\000\177\000\159\000\
    \165\000\174\000\182\000\174\000\171\000\185\000\185\000\114\003\
    \192\003\236\000\231\000\201\000\190\000\187\000\186\000\204\000\
    \194\000\194\000\208\000\200\000\215\000\217\000\206\000\211\000\
    \215\000\220\000\222\000\203\000\223\000\225\000\224\000\231\000\
    \212\000\222\000\215\000\037\001";
  Lexing.lex_backtrk = 
   "\255\255\255\255\255\255\010\000\009\000\007\000\001\000\001\000\
    \255\255\006\000\007\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\002\000\001\000\
    \255\255\003\000\255\255\255\255\255\255\003\000\255\255\003\000\
    \000\000\255\255\003\000\002\000\000\000\255\255\001\000\255\255\
    \255\255\000\000\255\255\002\000\255\255\255\255\000\000\255\255\
    \002\000\002\000\255\255\255\255\255\255\003\000\255\255\003\000\
    \255\255\003\000\003\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\001\000\003\000\002\000\255\255\
    \255\255\002\000\001\000\255\255\001\000\255\255\002\000\002\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\003\000\003\000\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\011\000\255\255\255\255\012\000\
    \255\255\001\000\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\005\000\005\000\005\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\002\000\255\255\255\255\255\255\
    \000\000\255\255\255\255\006\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255";
  Lexing.lex_default = 
   "\003\000\000\000\000\000\003\000\255\255\255\255\255\255\003\000\
    \000\000\255\255\255\255\000\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\000\000\255\255\255\255\
    \255\255\255\255\255\255\000\000\000\000\000\000\255\255\255\255\
    \027\000\255\255\255\255\000\000\027\000\255\255\040\000\255\255\
    \040\000\255\255\044\000\255\255\044\000\035\000\255\255\255\255\
    \035\000\255\255\035\000\255\255\255\255\035\000\255\255\021\000\
    \255\255\255\255\255\255\255\255\027\000\255\255\027\000\255\255\
    \027\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\021\000\255\255\255\255\255\255\035\000\
    \021\000\255\255\255\255\255\255\255\255\021\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\027\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\035\000\035\000\001\000\255\255\000\000\000\000\255\255\
    \000\000\255\255\255\255\255\255\255\255\255\255\255\255\000\000\
    \011\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\035\000\
    \255\255\021\000\112\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\021\000";
  Lexing.lex_trans = 
   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\007\000\008\000\255\255\035\000\006\000\255\255\000\000\
    \008\000\010\000\255\255\006\000\009\000\007\000\255\255\006\000\
    \031\000\006\000\010\000\000\000\031\000\031\000\008\000\000\000\
    \007\000\031\000\008\000\029\000\035\000\082\000\004\000\255\255\
    \010\000\012\000\006\000\009\000\007\000\013\000\028\000\031\000\
    \034\000\010\000\255\255\033\000\031\000\083\000\255\255\009\000\
    \008\000\255\255\035\000\008\000\005\000\255\255\001\000\255\255\
    \009\000\024\000\026\000\022\000\015\000\017\000\021\000\011\000\
    \255\255\023\000\255\255\035\000\035\000\021\000\008\000\016\000\
    \020\000\052\000\043\000\255\255\018\000\025\000\255\255\037\000\
    \035\000\019\000\058\000\014\000\027\000\041\000\071\000\039\000\
    \008\000\024\000\026\000\022\000\058\000\255\255\067\000\068\000\
    \255\255\023\000\255\255\066\000\069\000\035\000\065\000\255\255\
    \063\000\058\000\061\000\008\000\035\000\025\000\021\000\070\000\
    \035\000\008\000\072\000\058\000\073\000\008\000\074\000\035\000\
    \008\000\008\000\035\000\008\000\081\000\255\255\035\000\255\255\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\035\000\008\000\008\000\093\000\088\000\089\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\057\000\059\000\059\000\078\000\086\000\090\000\
    \091\000\078\000\087\000\092\000\008\000\094\000\095\000\096\000\
    \097\000\035\000\021\000\102\000\101\000\008\000\103\000\104\000\
    \035\000\057\000\059\000\059\000\078\000\008\000\078\000\035\000\
    \008\000\114\000\078\000\113\000\115\000\116\000\117\000\113\000\
    \118\000\119\000\028\000\100\000\132\000\127\000\124\000\099\000\
    \125\000\126\000\008\000\128\000\129\000\078\000\056\000\058\000\
    \058\000\130\000\113\000\131\000\035\000\133\000\134\000\027\000\
    \002\000\255\255\028\000\158\000\155\000\123\000\021\000\150\000\
    \255\255\008\000\139\000\121\000\255\255\140\000\035\000\141\000\
    \122\000\144\000\142\000\145\000\021\000\008\000\021\000\146\000\
    \021\000\147\000\148\000\143\000\149\000\021\000\151\000\152\000\
    \153\000\154\000\027\000\156\000\157\000\028\000\159\000\008\000\
    \160\000\161\000\162\000\011\000\255\255\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\008\000\
    \000\000\255\255\000\000\000\000\035\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\008\000\
    \035\000\000\000\000\000\000\000\000\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\049\000\
    \000\000\000\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\008\000\000\000\000\000\
    \000\000\049\000\000\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\000\000\000\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\000\000\000\000\000\000\000\000\049\000\
    \000\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\054\000\000\000\000\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\000\000\000\000\000\000\000\000\000\000\000\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\000\000\000\000\000\000\000\000\054\000\000\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\000\000\000\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\000\000\
    \000\000\000\000\000\000\054\000\000\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\113\000\
    \008\000\000\000\000\000\113\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\113\000\000\000\
    \000\000\111\000\000\000\000\000\000\000\000\000\021\000\027\000\
    \029\000\110\000\028\000\108\000\000\000\000\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\000\000\000\000\000\000\011\000\109\000\000\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\000\000\000\000\000\000\000\000\108\000\000\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\112\000\000\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\000\000\
    \000\000\000\000\000\000\108\000\000\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\136\000\
    \000\000\000\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\000\000\000\000\000\000\
    \000\000\136\000\000\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\000\000\000\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\000\000\000\000\000\000\000\000\136\000\
    \000\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000";
  Lexing.lex_check = 
   "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\000\000\000\000\003\000\038\000\000\000\003\000\255\255\
    \032\000\005\000\040\000\006\000\009\000\007\000\007\000\006\000\
    \031\000\007\000\010\000\255\255\031\000\030\000\030\000\255\255\
    \000\000\030\000\036\000\004\000\043\000\081\000\000\000\003\000\
    \005\000\005\000\006\000\009\000\007\000\012\000\013\000\031\000\
    \033\000\010\000\007\000\032\000\030\000\082\000\042\000\005\000\
    \060\000\042\000\061\000\062\000\000\000\003\000\000\000\003\000\
    \010\000\023\000\025\000\014\000\012\000\016\000\020\000\005\000\
    \007\000\022\000\007\000\034\000\037\000\041\000\050\000\015\000\
    \019\000\051\000\042\000\044\000\017\000\024\000\044\000\036\000\
    \052\000\018\000\056\000\012\000\026\000\039\000\065\000\038\000\
    \051\000\023\000\025\000\014\000\058\000\040\000\066\000\067\000\
    \042\000\022\000\042\000\064\000\068\000\063\000\064\000\044\000\
    \062\000\056\000\060\000\056\000\061\000\024\000\064\000\069\000\
    \056\000\070\000\071\000\058\000\072\000\058\000\073\000\074\000\
    \076\000\075\000\058\000\079\000\080\000\044\000\075\000\044\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\
    \045\000\045\000\063\000\083\000\084\000\086\000\087\000\088\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\
    \045\000\045\000\055\000\057\000\059\000\078\000\085\000\089\000\
    \090\000\078\000\085\000\091\000\092\000\093\000\094\000\095\000\
    \096\000\097\000\098\000\099\000\100\000\101\000\102\000\103\000\
    \104\000\055\000\057\000\059\000\078\000\105\000\077\000\077\000\
    \106\000\111\000\077\000\113\000\114\000\115\000\116\000\113\000\
    \117\000\118\000\120\000\098\000\121\000\122\000\123\000\098\000\
    \124\000\125\000\126\000\127\000\128\000\077\000\055\000\057\000\
    \059\000\129\000\113\000\130\000\131\000\132\000\133\000\134\000\
    \000\000\003\000\038\000\140\000\141\000\120\000\032\000\142\000\
    \040\000\138\000\138\000\120\000\007\000\139\000\138\000\139\000\
    \120\000\143\000\139\000\144\000\062\000\137\000\060\000\145\000\
    \036\000\146\000\147\000\139\000\148\000\149\000\150\000\151\000\
    \152\000\153\000\154\000\155\000\156\000\157\000\158\000\046\000\
    \159\000\160\000\161\000\162\000\042\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\163\000\
    \255\255\044\000\255\255\255\255\163\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\046\000\
    \046\000\046\000\046\000\046\000\046\000\046\000\046\000\047\000\
    \137\000\255\255\255\255\255\255\255\255\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\048\000\
    \255\255\255\255\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\048\000\255\255\255\255\255\255\
    \255\255\255\255\255\255\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\048\000\077\000\255\255\255\255\
    \255\255\048\000\255\255\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\048\000\049\000\255\255\255\255\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\255\255\255\255\255\255\255\255\049\000\
    \255\255\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\053\000\255\255\255\255\053\000\053\000\
    \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\
    \053\000\255\255\255\255\255\255\255\255\255\255\255\255\053\000\
    \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\
    \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\
    \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\
    \053\000\255\255\255\255\255\255\255\255\053\000\255\255\053\000\
    \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\
    \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\
    \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\
    \053\000\054\000\255\255\255\255\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\255\255\
    \255\255\255\255\255\255\054\000\255\255\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\107\000\
    \107\000\255\255\255\255\107\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\107\000\255\255\
    \255\255\107\000\255\255\255\255\255\255\255\255\107\000\107\000\
    \107\000\107\000\107\000\107\000\255\255\255\255\107\000\107\000\
    \107\000\107\000\107\000\107\000\107\000\107\000\107\000\107\000\
    \107\000\255\255\255\255\255\255\107\000\107\000\255\255\107\000\
    \107\000\107\000\107\000\107\000\107\000\107\000\107\000\107\000\
    \107\000\107\000\107\000\107\000\107\000\107\000\107\000\107\000\
    \107\000\107\000\107\000\107\000\107\000\107\000\107\000\107\000\
    \107\000\255\255\255\255\255\255\255\255\107\000\255\255\107\000\
    \107\000\107\000\107\000\107\000\107\000\107\000\107\000\107\000\
    \107\000\107\000\107\000\107\000\107\000\107\000\107\000\107\000\
    \107\000\107\000\107\000\107\000\107\000\107\000\107\000\107\000\
    \107\000\108\000\107\000\255\255\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\255\255\
    \255\255\255\255\255\255\108\000\255\255\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\108\000\
    \108\000\108\000\108\000\108\000\108\000\108\000\108\000\135\000\
    \255\255\255\255\135\000\135\000\135\000\135\000\135\000\135\000\
    \135\000\135\000\135\000\135\000\135\000\255\255\255\255\255\255\
    \255\255\255\255\255\255\135\000\135\000\135\000\135\000\135\000\
    \135\000\135\000\135\000\135\000\135\000\135\000\135\000\135\000\
    \135\000\135\000\135\000\135\000\135\000\135\000\135\000\135\000\
    \135\000\135\000\135\000\135\000\135\000\255\255\255\255\255\255\
    \255\255\135\000\255\255\135\000\135\000\135\000\135\000\135\000\
    \135\000\135\000\135\000\135\000\135\000\135\000\135\000\135\000\
    \135\000\135\000\135\000\135\000\135\000\135\000\135\000\135\000\
    \135\000\135\000\135\000\135\000\135\000\136\000\255\255\255\255\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\255\255\255\255\255\255\255\255\136\000\
    \255\255\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\136\000\136\000\136\000\136\000\136\000\
    \136\000\136\000\136\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255";
  Lexing.lex_base_code = 
   "";
  Lexing.lex_backtrk_code = 
   "";
  Lexing.lex_default_code = 
   "";
  Lexing.lex_trans_code = 
   "";
  Lexing.lex_check_code = 
   "";
  Lexing.lex_code = 
   "";
}

let rec token lexbuf =
    __ocaml_lex_token_rec lexbuf 0
and __ocaml_lex_token_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 123 "xml_lexer.mll"
  (
			newline lexbuf;
			token lexbuf
		)
# 514 "xml_lexer.ml"

  | 1 ->
# 128 "xml_lexer.mll"
  (
			last_pos := lexeme_end lexbuf;
			token lexbuf
		)
# 522 "xml_lexer.ml"

  | 2 ->
# 133 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			ignore_spaces lexbuf;
			let root = ident_name lexbuf in
			ignore_spaces lexbuf;
			let data = dtd_data lexbuf in
			DocType (root, data)
		)
# 534 "xml_lexer.ml"

  | 3 ->
# 142 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			Buffer.reset tmp;
			PCData (cdata lexbuf)
		)
# 543 "xml_lexer.ml"

  | 4 ->
# 148 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			comment lexbuf;
			token lexbuf
		)
# 552 "xml_lexer.ml"

  | 5 ->
# 154 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			header lexbuf;
			token lexbuf;
		)
# 561 "xml_lexer.ml"

  | 6 ->
# 160 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			let tag = ident_name lexbuf in
			ignore_spaces lexbuf;
			close_tag lexbuf;
			Endtag tag
		)
# 572 "xml_lexer.ml"

  | 7 ->
# 168 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			let tag = ident_name lexbuf in
			ignore_spaces lexbuf;
			let attribs, closed = attributes lexbuf in
			Tag(tag, attribs, closed)
		)
# 583 "xml_lexer.ml"

  | 8 ->
# 176 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			Buffer.reset tmp;
			Buffer.add_string tmp (lexeme lexbuf);
			PCData (pcdata lexbuf)
		)
# 593 "xml_lexer.ml"

  | 9 ->
# 183 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			Buffer.reset tmp;
			Buffer.add_string tmp (entity lexbuf);
			PCData (pcdata lexbuf)
		)
# 603 "xml_lexer.ml"

  | 10 ->
# 190 "xml_lexer.mll"
  (
			last_pos := lexeme_start lexbuf;
			Buffer.reset tmp;
			Buffer.add_string tmp (lexeme lexbuf);
			PCData (pcdata lexbuf)
		)
# 613 "xml_lexer.ml"

  | 11 ->
# 196 "xml_lexer.mll"
       ( Eof )
# 618 "xml_lexer.ml"

  | 12 ->
# 198 "xml_lexer.mll"
  ( error lexbuf ENodeExpected )
# 623 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_token_rec lexbuf __ocaml_lex_state

and ignore_spaces lexbuf =
    __ocaml_lex_ignore_spaces_rec lexbuf 30
and __ocaml_lex_ignore_spaces_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 202 "xml_lexer.mll"
  (
			newline lexbuf;
			ignore_spaces lexbuf
		)
# 637 "xml_lexer.ml"

  | 1 ->
# 207 "xml_lexer.mll"
  ( ignore_spaces lexbuf )
# 642 "xml_lexer.ml"

  | 2 ->
# 209 "xml_lexer.mll"
  ( () )
# 647 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_ignore_spaces_rec lexbuf __ocaml_lex_state

and comment lexbuf =
    __ocaml_lex_comment_rec lexbuf 32
and __ocaml_lex_comment_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 213 "xml_lexer.mll"
  (
			newline lexbuf;
			comment lexbuf
		)
# 661 "xml_lexer.ml"

  | 1 ->
# 218 "xml_lexer.mll"
  ( () )
# 666 "xml_lexer.ml"

  | 2 ->
# 220 "xml_lexer.mll"
  ( raise (Error EUnterminatedComment) )
# 671 "xml_lexer.ml"

  | 3 ->
# 222 "xml_lexer.mll"
  ( comment lexbuf )
# 676 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_comment_rec lexbuf __ocaml_lex_state

and header lexbuf =
    __ocaml_lex_header_rec lexbuf 36
and __ocaml_lex_header_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 226 "xml_lexer.mll"
  (
			newline lexbuf;
			header lexbuf
		)
# 690 "xml_lexer.ml"

  | 1 ->
# 231 "xml_lexer.mll"
  ( () )
# 695 "xml_lexer.ml"

  | 2 ->
# 233 "xml_lexer.mll"
  ( error lexbuf ECloseExpected )
# 700 "xml_lexer.ml"

  | 3 ->
# 235 "xml_lexer.mll"
  ( header lexbuf )
# 705 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_header_rec lexbuf __ocaml_lex_state

and cdata lexbuf =
    __ocaml_lex_cdata_rec lexbuf 38
and __ocaml_lex_cdata_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 239 "xml_lexer.mll"
  (
			Buffer.add_string tmp (lexeme lexbuf);
			cdata lexbuf
		)
# 719 "xml_lexer.ml"

  | 1 ->
# 244 "xml_lexer.mll"
  (
			newline lexbuf;
			Buffer.add_string tmp (lexeme lexbuf);
			cdata lexbuf
		)
# 728 "xml_lexer.ml"

  | 2 ->
# 250 "xml_lexer.mll"
  ( Buffer.contents tmp )
# 733 "xml_lexer.ml"

  | 3 ->
# 252 "xml_lexer.mll"
  (
			Buffer.add_string tmp (lexeme lexbuf);
			cdata lexbuf
		)
# 741 "xml_lexer.ml"

  | 4 ->
# 257 "xml_lexer.mll"
  ( error lexbuf ECloseExpected )
# 746 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_cdata_rec lexbuf __ocaml_lex_state

and pcdata lexbuf =
    __ocaml_lex_pcdata_rec lexbuf 42
and __ocaml_lex_pcdata_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 261 "xml_lexer.mll"
  (
			Buffer.add_string tmp (lexeme lexbuf);
			pcdata lexbuf
		)
# 760 "xml_lexer.ml"

  | 1 ->
# 266 "xml_lexer.mll"
  (
			Buffer.add_string tmp (lexeme lexbuf);
			pcdata lexbuf;
		)
# 768 "xml_lexer.ml"

  | 2 ->
# 271 "xml_lexer.mll"
  (
			Buffer.add_string tmp (entity lexbuf);
			pcdata lexbuf
		)
# 776 "xml_lexer.ml"

  | 3 ->
# 276 "xml_lexer.mll"
  ( Buffer.contents tmp )
# 781 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_pcdata_rec lexbuf __ocaml_lex_state

and entity lexbuf =
    __ocaml_lex_entity_rec lexbuf 45
and __ocaml_lex_entity_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 280 "xml_lexer.mll"
  (
			let ident = lexeme lexbuf in
			try
				Hashtbl.find idents (String.lowercase ident)
			with
				Not_found -> "&" ^ ident
		)
# 798 "xml_lexer.ml"

  | 1 ->
# 288 "xml_lexer.mll"
  ( raise (Error EUnterminatedEntity) )
# 803 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_entity_rec lexbuf __ocaml_lex_state

and ident_name lexbuf =
    __ocaml_lex_ident_name_rec lexbuf 48
and __ocaml_lex_ident_name_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 292 "xml_lexer.mll"
  ( lexeme lexbuf )
# 814 "xml_lexer.ml"

  | 1 ->
# 294 "xml_lexer.mll"
  ( error lexbuf EIdentExpected )
# 819 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_ident_name_rec lexbuf __ocaml_lex_state

and close_tag lexbuf =
    __ocaml_lex_close_tag_rec lexbuf 50
and __ocaml_lex_close_tag_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 298 "xml_lexer.mll"
  ( () )
# 830 "xml_lexer.ml"

  | 1 ->
# 300 "xml_lexer.mll"
  ( error lexbuf ECloseExpected )
# 835 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_close_tag_rec lexbuf __ocaml_lex_state

and attributes lexbuf =
    __ocaml_lex_attributes_rec lexbuf 51
and __ocaml_lex_attributes_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 304 "xml_lexer.mll"
  ( [], false )
# 846 "xml_lexer.ml"

  | 1 ->
# 306 "xml_lexer.mll"
  ( [], true )
# 851 "xml_lexer.ml"

  | 2 ->
# 308 "xml_lexer.mll"
  (
			let key = attribute lexbuf in
			let data = attribute_data lexbuf in
			ignore_spaces lexbuf;
			let others, closed = attributes lexbuf in
			(key, data) :: others, closed
		)
# 862 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_attributes_rec lexbuf __ocaml_lex_state

and attribute lexbuf =
    __ocaml_lex_attribute_rec lexbuf 53
and __ocaml_lex_attribute_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 318 "xml_lexer.mll"
  ( lexeme lexbuf )
# 873 "xml_lexer.ml"

  | 1 ->
# 320 "xml_lexer.mll"
  ( error lexbuf EAttributeNameExpected )
# 878 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_attribute_rec lexbuf __ocaml_lex_state

and attribute_data lexbuf =
    __ocaml_lex_attribute_data_rec lexbuf 55
and __ocaml_lex_attribute_data_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 324 "xml_lexer.mll"
  (
			Buffer.reset tmp;
			last_pos := lexeme_end lexbuf;
			dq_string lexbuf
		)
# 893 "xml_lexer.ml"

  | 1 ->
# 330 "xml_lexer.mll"
  (
			Buffer.reset tmp;
			last_pos := lexeme_end lexbuf;
			q_string lexbuf
		)
# 902 "xml_lexer.ml"

  | 2 ->
# 336 "xml_lexer.mll"
  ( error lexbuf EAttributeValueExpected )
# 907 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_attribute_data_rec lexbuf __ocaml_lex_state

and dq_string lexbuf =
    __ocaml_lex_dq_string_rec lexbuf 60
and __ocaml_lex_dq_string_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 340 "xml_lexer.mll"
  ( Buffer.contents tmp )
# 918 "xml_lexer.ml"

  | 1 ->
# 342 "xml_lexer.mll"
  (
			Buffer.add_char tmp (lexeme_char lexbuf 1);
			dq_string lexbuf
		)
# 926 "xml_lexer.ml"

  | 2 ->
# 347 "xml_lexer.mll"
  ( raise (Error EUnterminatedString) )
# 931 "xml_lexer.ml"

  | 3 ->
# 349 "xml_lexer.mll"
  ( 
			Buffer.add_char tmp (lexeme_char lexbuf 0);
			dq_string lexbuf
		)
# 939 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dq_string_rec lexbuf __ocaml_lex_state

and q_string lexbuf =
    __ocaml_lex_q_string_rec lexbuf 62
and __ocaml_lex_q_string_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 356 "xml_lexer.mll"
  ( Buffer.contents tmp )
# 950 "xml_lexer.ml"

  | 1 ->
# 358 "xml_lexer.mll"
  (
			Buffer.add_char tmp (lexeme_char lexbuf 1);
			q_string lexbuf
		)
# 958 "xml_lexer.ml"

  | 2 ->
# 363 "xml_lexer.mll"
  ( raise (Error EUnterminatedString) )
# 963 "xml_lexer.ml"

  | 3 ->
# 365 "xml_lexer.mll"
  ( 
			Buffer.add_char tmp (lexeme_char lexbuf 0);
			q_string lexbuf
		)
# 971 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_q_string_rec lexbuf __ocaml_lex_state

and dtd_data lexbuf =
    __ocaml_lex_dtd_data_rec lexbuf 64
and __ocaml_lex_dtd_data_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 372 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			(* skipping Public ID *)
			let _ = dtd_file lexbuf in
			let file = dtd_file lexbuf in
			dtd_end_decl lexbuf;
			DTDFile file
		)
# 989 "xml_lexer.ml"

  | 1 ->
# 381 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			let file = dtd_file lexbuf in
			dtd_end_decl lexbuf;
			DTDFile file
		)
# 999 "xml_lexer.ml"

  | 2 ->
# 388 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			let data = dtd_intern lexbuf in
			dtd_end_decl lexbuf;
			DTDData data
		)
# 1009 "xml_lexer.ml"

  | 3 ->
# 395 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDDecl )
# 1014 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_data_rec lexbuf __ocaml_lex_state

and dtd_file lexbuf =
    __ocaml_lex_dtd_file_rec lexbuf 75
and __ocaml_lex_dtd_file_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 399 "xml_lexer.mll"
  (
			Buffer.reset tmp;
			let s = dq_string lexbuf in
			ignore_spaces lexbuf;
			s
		)
# 1030 "xml_lexer.ml"

  | 1 ->
# 406 "xml_lexer.mll"
  (
			Buffer.reset tmp;
			let s = q_string lexbuf in
			ignore_spaces lexbuf;
			s
		)
# 1040 "xml_lexer.ml"

  | 2 ->
# 413 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDDecl )
# 1045 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_file_rec lexbuf __ocaml_lex_state

and dtd_intern lexbuf =
    __ocaml_lex_dtd_intern_rec lexbuf 76
and __ocaml_lex_dtd_intern_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 417 "xml_lexer.mll"
  ( 
			ignore_spaces lexbuf;
			[]
		)
# 1059 "xml_lexer.ml"

  | 1 ->
# 422 "xml_lexer.mll"
  (
			let l = dtd_item lexbuf in
			l @ (dtd_intern lexbuf)
		)
# 1067 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_intern_rec lexbuf __ocaml_lex_state

and dtd lexbuf =
    __ocaml_lex_dtd_rec lexbuf 77
and __ocaml_lex_dtd_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 429 "xml_lexer.mll"
  ( [] )
# 1078 "xml_lexer.ml"

  | 1 ->
# 431 "xml_lexer.mll"
  (
			newline lexbuf;
			dtd lexbuf
		)
# 1086 "xml_lexer.ml"

  | 2 ->
# 436 "xml_lexer.mll"
  ( dtd lexbuf )
# 1091 "xml_lexer.ml"

  | 3 ->
# 438 "xml_lexer.mll"
  (
			let l = dtd_item lexbuf in
			l @ (dtd lexbuf)
		)
# 1099 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_rec lexbuf __ocaml_lex_state

and dtd_end_decl lexbuf =
    __ocaml_lex_dtd_end_decl_rec lexbuf 79
and __ocaml_lex_dtd_end_decl_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 445 "xml_lexer.mll"
  ( ignore_spaces lexbuf )
# 1110 "xml_lexer.ml"

  | 1 ->
# 447 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDDecl )
# 1115 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_end_decl_rec lexbuf __ocaml_lex_state

and dtd_item lexbuf =
    __ocaml_lex_dtd_item_rec lexbuf 80
and __ocaml_lex_dtd_item_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 451 "xml_lexer.mll"
  (
			comment lexbuf;
			[];
		)
# 1129 "xml_lexer.ml"

  | 1 ->
# 456 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			let t = dtd_item_type lexbuf in
			let name = (try ident_name lexbuf with Error EIdentExpected -> raise (DTDError EInvalidDTDDecl)) in
			ignore_spaces lexbuf;
			match t with
			| TElement -> [ DTDElement (name , (dtd_element_type lexbuf)) ]
			| TAttribute -> List.map (fun (attrname,atype,adef) -> DTDAttribute (name, attrname, atype, adef)) (dtd_attributes lexbuf)
		)
# 1142 "xml_lexer.ml"

  | 2 ->
# 466 "xml_lexer.mll"
  (  dtd_error lexbuf EDTDItemExpected )
# 1147 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_item_rec lexbuf __ocaml_lex_state

and dtd_attributes lexbuf =
    __ocaml_lex_dtd_attributes_rec lexbuf 84
and __ocaml_lex_dtd_attributes_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 470 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			[]
		)
# 1161 "xml_lexer.ml"

  | 1 ->
# 475 "xml_lexer.mll"
  (
			let attrname = (try ident_name lexbuf with Error EIdentExpected -> raise (DTDError EInvalidDTDAttribute)) in
			ignore_spaces lexbuf;
			let atype = dtd_attr_type lexbuf in
			let adef = dtd_attr_default lexbuf in
			let a = (attrname, atype, adef) in
			a :: (dtd_attributes lexbuf)
		)
# 1173 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_attributes_rec lexbuf __ocaml_lex_state

and dtd_item_type lexbuf =
    __ocaml_lex_dtd_item_type_rec lexbuf 85
and __ocaml_lex_dtd_item_type_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 486 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			TElement
		)
# 1187 "xml_lexer.ml"

  | 1 ->
# 491 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			TAttribute
		)
# 1195 "xml_lexer.ml"

  | 2 ->
# 496 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDTag )
# 1200 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_item_type_rec lexbuf __ocaml_lex_state

and dtd_element_type lexbuf =
    __ocaml_lex_dtd_element_type_rec lexbuf 98
and __ocaml_lex_dtd_element_type_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 500 "xml_lexer.mll"
  ( 
			ignore_spaces lexbuf;
			dtd_end_element lexbuf;
			DTDAny
		)
# 1215 "xml_lexer.ml"

  | 1 ->
# 506 "xml_lexer.mll"
  ( 
			ignore_spaces lexbuf;
			dtd_end_element lexbuf;
			DTDEmpty
		)
# 1224 "xml_lexer.ml"

  | 2 ->
# 512 "xml_lexer.mll"
  (
			try
				let item = Xml_parser.dtd_element dtd_element_token lexbuf in
				ignore_spaces lexbuf;
				DTDChild item
			with
				Parsing.Parse_error -> dtd_error lexbuf EInvalidDTDElement
		)
# 1236 "xml_lexer.ml"

  | 3 ->
# 521 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDElement )
# 1241 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_element_type_rec lexbuf __ocaml_lex_state

and dtd_end_element lexbuf =
    __ocaml_lex_dtd_end_element_rec lexbuf 105
and __ocaml_lex_dtd_end_element_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 525 "xml_lexer.mll"
  ( ignore_spaces lexbuf )
# 1252 "xml_lexer.ml"

  | 1 ->
# 527 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDElement )
# 1257 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_end_element_rec lexbuf __ocaml_lex_state

and dtd_end_attribute lexbuf =
    __ocaml_lex_dtd_end_attribute_rec lexbuf 106
and __ocaml_lex_dtd_end_attribute_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 531 "xml_lexer.mll"
  ( ignore_spaces lexbuf )
# 1268 "xml_lexer.ml"

  | 1 ->
# 533 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDAttribute )
# 1273 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_end_attribute_rec lexbuf __ocaml_lex_state

and dtd_element_token lexbuf =
    __ocaml_lex_dtd_element_token_rec lexbuf 107
and __ocaml_lex_dtd_element_token_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 537 "xml_lexer.mll"
  (
			newline lexbuf;
			dtd_element_token lexbuf
		)
# 1287 "xml_lexer.ml"

  | 1 ->
# 542 "xml_lexer.mll"
  ( dtd_element_token lexbuf )
# 1292 "xml_lexer.ml"

  | 2 ->
# 544 "xml_lexer.mll"
  ( OPEN )
# 1297 "xml_lexer.ml"

  | 3 ->
# 546 "xml_lexer.mll"
  ( CLOSE )
# 1302 "xml_lexer.ml"

  | 4 ->
# 548 "xml_lexer.mll"
  ( NEXT )
# 1307 "xml_lexer.ml"

  | 5 ->
# 550 "xml_lexer.mll"
  ( END )
# 1312 "xml_lexer.ml"

  | 6 ->
# 552 "xml_lexer.mll"
  ( OR )
# 1317 "xml_lexer.ml"

  | 7 ->
# 554 "xml_lexer.mll"
  ( PCDATA )
# 1322 "xml_lexer.ml"

  | 8 ->
# 556 "xml_lexer.mll"
  ( STAR )
# 1327 "xml_lexer.ml"

  | 9 ->
# 558 "xml_lexer.mll"
  ( PLUS )
# 1332 "xml_lexer.ml"

  | 10 ->
# 560 "xml_lexer.mll"
  ( QUESTION )
# 1337 "xml_lexer.ml"

  | 11 ->
# 562 "xml_lexer.mll"
  ( IDENT (lexeme lexbuf) )
# 1342 "xml_lexer.ml"

  | 12 ->
# 564 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDElement )
# 1347 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_element_token_rec lexbuf __ocaml_lex_state

and dtd_attr_type lexbuf =
    __ocaml_lex_dtd_attr_type_rec lexbuf 120
and __ocaml_lex_dtd_attr_type_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 568 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			DTDCData
		)
# 1361 "xml_lexer.ml"

  | 1 ->
# 573 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			DTDNMToken
		)
# 1369 "xml_lexer.ml"

  | 2 ->
# 578 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
		 	DTDID
		)
# 1377 "xml_lexer.ml"

  | 3 ->
# 583 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			DTDIDRef
		)
# 1385 "xml_lexer.ml"

  | 4 ->
# 588 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			DTDEnum (dtd_attr_enum lexbuf)
		)
# 1393 "xml_lexer.ml"

  | 5 ->
# 593 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDAttribute )
# 1398 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_attr_type_rec lexbuf __ocaml_lex_state

and dtd_attr_enum lexbuf =
    __ocaml_lex_dtd_attr_enum_rec lexbuf 135
and __ocaml_lex_dtd_attr_enum_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 597 "xml_lexer.mll"
  (
			let v = lexeme lexbuf in
			ignore_spaces lexbuf;
			v :: (dtd_attr_enum_next lexbuf)
		)
# 1413 "xml_lexer.ml"

  | 1 ->
# 603 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDAttribute )
# 1418 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_attr_enum_rec lexbuf __ocaml_lex_state

and dtd_attr_enum_next lexbuf =
    __ocaml_lex_dtd_attr_enum_next_rec lexbuf 137
and __ocaml_lex_dtd_attr_enum_next_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 607 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			[]
		)
# 1432 "xml_lexer.ml"

  | 1 ->
# 612 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			dtd_attr_enum lexbuf
		)
# 1440 "xml_lexer.ml"

  | 2 ->
# 617 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDAttribute )
# 1445 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_attr_enum_next_rec lexbuf __ocaml_lex_state

and dtd_attr_default lexbuf =
    __ocaml_lex_dtd_attr_default_rec lexbuf 138
and __ocaml_lex_dtd_attr_default_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 621 "xml_lexer.mll"
  (
			Buffer.reset tmp;
			let v = (try dq_string lexbuf with Error EUnterminatedString -> raise (DTDError EInvalidDTDAttribute)) in
			ignore_spaces lexbuf;
			DTDDefault v
		)
# 1461 "xml_lexer.ml"

  | 1 ->
# 628 "xml_lexer.mll"
  (
			Buffer.reset tmp;
			let v = (try q_string lexbuf with Error EUnterminatedString -> raise (DTDError EInvalidDTDAttribute)) in
			ignore_spaces lexbuf;
			DTDDefault v
		)
# 1471 "xml_lexer.ml"

  | 2 ->
# 635 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			DTDRequired
		)
# 1479 "xml_lexer.ml"

  | 3 ->
# 640 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			DTDImplied
		)
# 1487 "xml_lexer.ml"

  | 4 ->
# 645 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			DTDFixed (dtd_attr_string lexbuf)
		)
# 1495 "xml_lexer.ml"

  | 5 ->
# 650 "xml_lexer.mll"
  (
			ignore_spaces lexbuf;
			DTDDefault (dtd_attr_string lexbuf)
		)
# 1503 "xml_lexer.ml"

  | 6 ->
# 655 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDAttribute )
# 1508 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_attr_default_rec lexbuf __ocaml_lex_state

and dtd_attr_string lexbuf =
    __ocaml_lex_dtd_attr_string_rec lexbuf 163
and __ocaml_lex_dtd_attr_string_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 659 "xml_lexer.mll"
  (
			Buffer.reset tmp;
			let v = (try dq_string lexbuf with Error EUnterminatedString -> raise (DTDError EInvalidDTDAttribute)) in
			ignore_spaces lexbuf;
			v
		)
# 1524 "xml_lexer.ml"

  | 1 ->
# 666 "xml_lexer.mll"
  (
			Buffer.reset tmp;
			let v = (try q_string lexbuf with Error EUnterminatedString -> raise (DTDError EInvalidDTDAttribute)) in
			ignore_spaces lexbuf;
			v
		)
# 1534 "xml_lexer.ml"

  | 2 ->
# 673 "xml_lexer.mll"
  ( dtd_error lexbuf EInvalidDTDAttribute )
# 1539 "xml_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dtd_attr_string_rec lexbuf __ocaml_lex_state

;;

